//
//  BMAConstants.h
//  Autismus
//
//  Created by Nicolas CHENG on 03/12/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <stdlib.h>

#define AUTIMO_STATS_HEXCOLOR_PAIRES        @"#F07931"
#define AUTIMO_STATS_HEXCOLOR_INTRUS        @"#EB3389"
#define AUTIMO_STATS_HEXCOLOR_DEVINETTES    @"#BDCF3E"

typedef enum {
    BMAEmotionEnColere = 0,
    BMAEmotionEffraye,
    BMAEmotionJoyeux,
    BMAEmotionTriste,
    BMAEmotionEtonne,
    BMAEmotionMalade
} BMAEmotion;

typedef enum {
  BMATypeVignettePhoto,
  BMATypeVignetteIllustration
} BMATypeVignette;

typedef enum {
    BMAIDGamePaires = 0,
    BMAIDGameIntrus,
    BMAIDGameDevinettes
} BMAIDGame;

#ifdef UI_USER_INTERFACE_IDIOM
    #define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#else
    #define IS_IPAD() (false)
#endif

// RAND_UINT() positive unsigned integer from 0 to RAND_UINT_MAX
// RAND_INT() positive integer from 0 to RAND_INT_MAX
// RAND_INT_VAL(a,b) integer on the interval [a,b] (includes a and b)
#define RAND_UINT()				arc4random()
#define RAND_INT()				((int)(arc4random() & 0x7FFFFFFF))
#define RAND_INT_VAL(a, b)		((arc4random() % ((b)-(a)+1)) + (a))

#ifdef DEBUG
    #define DLOG(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#else
    #define DLOG(...) do { } while (0)
    #ifndef NS_BLOCK_ASSERTIONS
        #define NS_BLOCK_ASSERTIONS
    #endif
#endif

#define DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \
static dispatch_once_t pred = 0; \
__strong static id _sharedObject = nil; \
dispatch_once(&pred, ^{ \
_sharedObject = block(); \
}); \
return _sharedObject; \
